const protocol = window.location.protocol;
const api = {
  dev: {
    FUYAO_HOST: `${protocol}//software.myhexin.com/yapi/mock_new`,
    DICT_HOST: 'http://dict-test.hexin.cn:9530',
    EQ_HOST: `${protocol}//eq.10jqka.com.cn`,
    APIGATE_HOST: `${protocol}//apigate-test.10jqka.com.cn`,
  },
  test: {
    FUYAO_HOST: `${protocol}//dq.10jqka.com.cn/fuyao`,
    // 此接口必须写死http，并且只有使用客户端协议发送请求,不然会跨域
    DICT_HOST: 'http://dict.hexin.cn:9530',
    EQ_HOST: `${protocol}//eq.10jqka.com.cn`,
    APIGATE_HOST: `${protocol}//apigate.10jqka.com.cn`,
  },
  release: {
    FUYAO_HOST: `${protocol}//dq.10jqka.com.cn/fuyao`,
    // 此接口必须写死http，并且只有使用客户端协议发送请求,不然会跨域
    DICT_HOST: 'http://dict.hexin.cn:9530',
    EQ_HOST: `${protocol}//eq.10jqka.com.cn`,
    APIGATE_HOST: `${protocol}//apigate.10jqka.com.cn`,
  },
};

const url = {
  dev: {
    payUrl: `${protocol}//pay.10jqka.com.cn/onlinePayment/indexForH5.html`,
    homeLoadPage: `${protocol}//mams.10jqka.com.cn/new/server/html/52085.html`,
    stockLoadPage: `${protocol}//mams.10jqka.com.cn/new/server/html/63659.html`,
  },
  test: {
    payUrl: `${protocol}//testm.10jqka.com.cn/pay/onlinePayment/indexForH5.html`,
    homeLoadPage: `${protocol}//mams.10jqka.com.cn/new/server/html/52085.html`,
    stockLoadPage: `${protocol}//mams.10jqka.com.cn/new/server/html/63659.html`,
  },
  release: {
    payUrl: `${protocol}//pay.10jqka.com.cn/onlinePayment/indexForH5.html`,
    homeLoadPage: `${protocol}//mams.10jqka.com.cn/new/server/html/52085.html`,
    stockLoadPage: `${protocol}//mams.10jqka.com.cn/new/server/html/51145.html`,
  },
};

const env = ['productionPM', 'production'].includes(process.env.NODE_ENV) ? 'release' : 'test';

const authOptions = {
  basicAuth: 1,
  professionAuth: 2,
};

export default {
  env,
  api: api[env],
  url: url[env],
  authOptions,
};
